<script type="text/javascript">
	function deleteCustomers(){  
		var count = jQuery('input.ckbChild:checked').length;
		if (count == 0){
			jQuery('#dialogDeleteCustomer').html('<spring:message code="message.delete.empty.customer"/>');
			jQuery('#dialogDeleteCustomer').dialog({
		       	 modal:true,
		       	 resizable: false,
		         height:130,
	          	 width:400,	
		       	 title:'<spring:message code="message"/>',
		       	 buttons:{
		       	 	'<spring:message code="button.cancel"/>' : function() {jQuery("#dialogDeleteCustomer").dialog("close");}
		       	 }	
		 	});
	    }else{
		        jQuery('#dialogDeleteCustomer').html('<spring:message code="message.confirm.delete.customer"/>');	        
		    	jQuery('#dialogDeleteCustomer').dialog({
			       	 modal:true,
			       	 resizable: false,
			       	 height: 130,
			       	 width:400,	
			       	 title:'<spring:message code="message"/>',			         
			         buttons: {
			        	 '<spring:message code="button.ok"/>' : function() {
			        		    jQuery('input[name=cmd]').val('deleteCustomers');
			           			submitForm('frmCustomers'); 				 
			           	},
			           	'<spring:message code="button.cancel"/>' : function() {
				            jQuery('#dialogDeleteCustomer').dialog("close");
				            jQuery('input[type="checkbox"]:checked').each(function(){
				    			this.checked = false;
				    	  	});					  	       
				         }
			          }
			     });
		}	
	}  

	function imageValidate(image){
		var img =document.getElementById(image).value;
		if(img!=''){
			var checkimg = img.toLowerCase();
			if (!checkimg.match(/(\.jpg|\.png|\.JPG|\.PNG|\.jpeg|\.JPEG)$/)){
			document.getElementById(image).focus();
			$("#"+image+"").text('<spring:message code="warning.image.invalid.format"/>');
			return false;
			}
		}
		return true;
	}

	function pagingSubmit() {
		var searchKey = jQuery("input[name=searchKey]").val();
		var currentPageNum = jQuery("#paging").find(".page-selector select").val();
		var pageSize = jQuery("#paging").find("#itemsPerPage select").val();
		window.location.href = "${bean.pagingUrl}?key=" + searchKey
				+ "&currentPageNum=" + currentPageNum
				+ "&pageSize=" + pageSize;
	}

	jQuery(document).ready(function() {
		if (jQuery("input[name='name']").val() == 'null') {
			jQuery("input[name='name']").val('');
		}
		
		jQuery("#searchCustomers").click(function() {
			jQuery('input[name=cmd]').val('searchCustomers');
			submitForm('frmCustomers');
		});
	});
</script>